package com.ruoyi.receipt.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.receipt.domain.TbKnowledgeList;
import com.ruoyi.receipt.utils.UserInitUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.receipt.mapper.TbKnowledgeManagerMapper;
import com.ruoyi.receipt.domain.TbKnowledgeManager;
import com.ruoyi.receipt.service.ITbKnowledgeManagerService;

/**
 * 知识点管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-03-29
 */
@Service
public class TbKnowledgeManagerServiceImpl implements ITbKnowledgeManagerService 
{
    @Autowired
    private TbKnowledgeManagerMapper tbKnowledgeManagerMapper;

    /**
     * 查询知识点管理
     * 
     * @param id 知识点管理ID
     * @return 知识点管理
     */
    @Override
    public TbKnowledgeManager selectTbKnowledgeManagerById(Long id)
    {
        return tbKnowledgeManagerMapper.selectTbKnowledgeManagerById(id);
    }

    /**
     * 查询知识点管理列表
     * 
     * @param tbKnowledgeManager 知识点管理
     * @return 知识点管理
     */
    @Override
    @DataScope(deptAlias = "da",userAlias = "createId")
    public List<TbKnowledgeManager> selectTbKnowledgeManagerList(TbKnowledgeManager tbKnowledgeManager)
    {
        return tbKnowledgeManagerMapper.selectTbKnowledgeManagerList(tbKnowledgeManager);
    }

    @Override
    public List<TbKnowledgeManager> selectTbKnowledgeManagerListRec(TbKnowledgeManager tbKnowledgeManager) {
        return tbKnowledgeManagerMapper.selectTbKnowledgeManagerRecList(tbKnowledgeManager);
    }

    /**
     * 新增知识点管理
     * 
     * @param tbKnowledgeManager 知识点管理
     * @return 结果
     */
    @Override
    public int insertTbKnowledgeManager(TbKnowledgeManager tbKnowledgeManager)
    {
        tbKnowledgeManager.setCreateTime(DateUtils.getNowDate());
        UserInitUtils.initUserInfo(tbKnowledgeManager);
        return tbKnowledgeManagerMapper.insertTbKnowledgeManager(tbKnowledgeManager);
    }

    /**
     * 修改知识点管理
     * 
     * @param tbKnowledgeManager 知识点管理
     * @return 结果
     */
    @Override
    public int updateTbKnowledgeManager(TbKnowledgeManager tbKnowledgeManager)
    {
        tbKnowledgeManager.setUpdateTime(DateUtils.getNowDate());
        UserInitUtils.initUserInfoForUpdate(tbKnowledgeManager);
        return tbKnowledgeManagerMapper.updateTbKnowledgeManager(tbKnowledgeManager);
    }

    /**
     * 批量删除知识点管理
     * 
     * @param ids 需要删除的知识点管理ID
     * @return 结果
     */
    @Override
    public int deleteTbKnowledgeManagerByIds(Long[] ids)
    {
        return tbKnowledgeManagerMapper.deleteTbKnowledgeManagerByIds(ids);
    }

    /**
     * 逻辑删除知识点
     * @param ids
     * @return
     */
    @Override
    public int delManagerLogic(Long[] ids) {
        return tbKnowledgeManagerMapper.delManagerLogic(ids);
    }

    /**
     * 删除知识点管理信息
     * 
     * @param id 知识点管理ID
     * @return 结果
     */
    @Override
    public int deleteTbKnowledgeManagerById(Long id)
    {
        return tbKnowledgeManagerMapper.deleteTbKnowledgeManagerById(id);
    }

    @Override
    public List<TbKnowledgeManager> selectKmName(String name) {
        return tbKnowledgeManagerMapper.selectKmName(name);
    }

    @Override
    public List<TbKnowledgeManager> selectKonwledgeStatus(TbKnowledgeManager tbKnowledgeManager) {
        return tbKnowledgeManagerMapper.selectKonwledgeStatus(tbKnowledgeManager);
    }
}
